/*
 * kthread.h
 *
 *  Created on: Dec 7, 2011
 *      Author: kylintse
 */

#ifndef KTHREAD_H_
#define KTHREAD_H_

#include <QtCore>

class kthread : public QThread
{
public:
	kthread(QObject* parent=0);
	virtual ~kthread();

protected:
	bool needExit();
	void setStarted(bool flag);

public:
	bool start(int timeout);
	void exit();

private:
	bool m_exitFlag;
	QMutex m_lockExit;

	QMutex m_lockStart;
	QWaitCondition m_waitStart;
	bool m_startFlag;
};

#endif /* KTHREAD_H_ */
